package com.test.pattern.combination;

/**
 * @ClassName: MenuItem
 * @description: 菜单项类,属于叶子节点角色
 * @author: Mr du
 * @create: 2024-02-25 16:09
 */
public class MenuItem extends MenuComponent{

    public MenuItem(String name,int level) {
        this.name = name;
        this.level = level;
    }

    @Override
    public void print() {
        for (int i = 1; i < level; i++) {
            System.out.print("--");
        }
        //打印菜单项名称
        System.out.println(name);
    }
}
